/**
*	@class XInputGamePad
*
*	@brief
*
*	@author William McVicar
*/

#pragma once

#ifndef __XINPUTGAMEPAD_H_INCLUDED__
#define __XINPUTGAMEPAD_H_INCLUDED__
#if defined( DX10 ) || defined( DX11 )

//  Library Includes
#pragma comment( lib, "xinput.lib" )

//  Local Includes
#include <XInput.h>

//  Macros

//  Forward Declarations

//  Types

//  Constants

//  Prototypes

class XInputGamePad
{
	//Member Functions
public:

	XInputGamePad();
	~XInputGamePad();

	inline bool IsConnected() const;
	inline u32 ControllerNumber() const;

	void Poll();
	bool IsButtonDown( u16 _usButton );
	byte GetBatteryLevel();
	bool GetThumbStickValues( u16 _usThumb, i16* _pLX, u16* _pLY ); 

protected: 

private: 

	//Member Variables
public:

	static const i32				sm_kiMaxControllers;

protected: 

private: 

	XINPUT_STATE					m_tInputState;
	XINPUT_BATTERY_INFORMATION		m_tBatteryInformation;
	XINPUT_VIBRATION				m_tVibration;

	u32								m_uiControllerNumber;

	bool					m_bConnected;
};

inline bool XInputGamePad::IsConnected() const
{
	return m_bConnected;
}

inline u32 XInputGamePad::ControllerNumber() const
{
	return m_uiControllerNumber;
}

#endif

#endif //__XINPUTGAMEPAD_H_INCLUDED__
